package com.hansheng.dao.impl;

import com.hansheng.dao.MaterialDao;
import com.hansheng.entity.MaterialEntity;

import java.util.List;

/**
 * Created by GoldenMan on 2017/5/29.
 */
public class MaterialDaoImpl implements MaterialDao {
    private BaseDao baseDao;
    public void setBaseDao(BaseDao baseDao) {
        this.baseDao = baseDao;
    }

    @Override
    public boolean saveMaterial(MaterialEntity materialEntity) {
        return baseDao.saveEntity(materialEntity);
    }

    @Override
    public boolean deleteMaterialById(int mid) {
        return baseDao.deleteEntityById(MaterialEntity.class,mid);
    }

    @Override
    public boolean modifyMaterial(MaterialEntity materialEntity) {
        return baseDao.update(materialEntity);
    }

    @Override
    public List<MaterialEntity> getMaterialList() {
        return baseDao.getEntityList(MaterialEntity.class);
    }

    @Override
    public List getFatherMaterialList(String whereHql, Object[] params) {
        return baseDao.getEntityListByCondition(MaterialEntity.class, whereHql, params);
    }

    @Override
    public MaterialEntity getMaterialById(int mid) {
        return (MaterialEntity) baseDao.getEntity(MaterialEntity.class, mid);
    }

}
